package gang.com.mobelhelper.di;

import android.app.ProgressDialog;

import dagger.Module;
import dagger.Provides;
import gang.com.mobelhelper.data.http.ApiService;
import gang.com.mobelhelper.data.remote.RecommendModel;
import gang.com.mobelhelper.presenter.RecommendPresenter;
import gang.com.mobelhelper.presenter.contract.RecommendContract;
import gang.com.mobelhelper.ui.adapter.RecomendAppAdatper;
import gang.com.mobelhelper.ui.fragment.RecommendFragment;

/**
 * Created by xiaogangzai on 2017/7/16.
 * Moudle的一些内容添加,@Module这个内容就是告诉Dragger这个类是用来初始化的，它的工作就是New东西，这个里面可以有很多的@Provides
 */
@Module
public class RemmendMoudle {

    private RecommendContract.View mView;

    public RemmendMoudle(RecommendContract.View view) {

        this.mView = view;
    }

    //@Provides这个注解以此来告诉Dragger，这个方法是来提供实例的
    //修改了那个泛型的BasePresenter这个就不需要了
   /* @Provides
    public RecommendContract.Presenter providerPresenter(RecommendContract.View view, RecommendModel recommendModel) {
        return new RecommendPresenter(view, recommendModel);
    }*/

    @Provides
    public RecommendModel privodeModel(ApiService apiService) {
        return new RecommendModel(apiService);
    }

    @Provides
    public RecommendContract.View provideView() {
        return mView;
    }

    @Provides
    public RecomendAppAdatper provideAdapter() {
        return null;
    }

    @Provides
    public ProgressDialog provideProgressDialog(RecommendContract.View view) {
        return new ProgressDialog(((RecommendFragment) view).getActivity());
    }
}
